/ Program to test all operations

/ Code:

		ORG 100		

AND,	LDA A1		/ Test AND
		AND A2		/ Result should be 0204
		BUN ADD

ADD,	LDA A1		/ Test ADD
		ADD A2		/ Result should be BE01
		BUN LDA

LDA,	LDA A1		/ Test LDA
		LDA A2		/ Result should be ABCD
		LDA A3 I	/ Result should be 9876
		BUN STA

STA,	LDA A1		/ Test STA
		STA O1		/ O1 should contain 1234
		BUN BUN

BUN,	LDA A1		/ Test BUN
		BUN BN2
		LDA A2
BN2,	BUN BSA		/ AC should contain 1234

BSA,	LDA A1		/ Test BSA
		BSA BS2		
		BUN BS3
BS2,	HEX 0
		LDA A2
		BUN BS2 I
BS3,	BUN ISZ		/ AC should contain ABCD
		
ISZ,	LDA A1		/ Test ISZ
		ISZ A4
		LDA A2
		ISZ A4
		LDA A3
		BUN	CLA		/ AC should contain ABCD, A4 should contain 0

CLA,	LDA A1		/ Test CLA
		CLA			/ Before execution, AC should contain 1234
		BUN CLE		/ AC should now contain 0

CLE,	LDA C1		/ Test CLE
		ADD C2		/ This should set the E flag to 1
		CLE			/ This should clear the E flag
		BUN CMA

CMA,	LDA A1		/ Test LDA
		CMA
		BUN CME		/ AC should now be EDCB

CME,	LDA C1		/ Test CME
		ADD C2		/ This should set the E flag to 1
		CME			/ This should clear E
		CME			/ This should set E again
		BUN CIR

CIR,	LDA C2		/ Test CIR
		CIR
		BUN CIL		/ AC should now be 8000

CIL,	LDA C2		/ Test CIL
		CIL
		BUN INC		/ AC should now be 0002

INC,	LDA A1		/ Test INC
		INC
		BUN SPA		/ AC should now be 1235

SPA,	LDA C4		/ Test SPA
		SPA
		LDA A1		
		LDA C3		/ Before this, AC should be 1234
		SPA
		LDA A1
		BUN SNA		/ AC should be 000A

SNA,	LDA C3		/ Test SNA
		SNA
		LDA A1
		LDA C4		/ Before this, AC should be 1234
		SNA
		LDA A1
		BUN SZA		/ AC should be FFF6

SZA,	LDA C3		/ Test SZA
		SZA
		LDA C4		/ After this, AC should contain FFF6
		ADD C3		/ After this, AC should contain 0
		SZA
		LDA A1
		BUN SZE		/ AC should still contain 0

SZE,	LDA C1		/ Test SZE
		ADD C2		/ This should set the E flag to 1
		SZE
		LDA A1
		CME			/ AC should contain 1234
		SZE
		LDA A2
		BUN INP		/ AC should still contain 1234

INP,	LDA A1		/ Test INP
		INP			/ After this, AC should contain 1200
		BUN OUT

OUT,	LDA A1		/ Test OUT
		OUT			/ After this, OUTR should contain 34
		BUN SKI

SKI,	LDA A1		/ Test SKI
		SKI
		LDA A2
		BUN SKO		/ AC should contain ABCD

SKO,	LDA A1		/ Test SKO
		SKO
		LDA A2
		BUN ION		/ AC should contain ABCD

ION,	IOF			/ Test ION
		ION			
		BUN IOF		/ IEN should be 1

IOF,	ION			/ Test IOF
		IOF
		BUN HLT		/ IEN should be 0
		
HLT,	LDA A1
		HLT			/ System should halt
		LDA A2
		LDA A3		/ This line should never be reached

/ Data:
		
A1,		HEX 1234
A2,		HEX ABCD
A3,		HEX FFF
A4,		HEX FFFE

C1,		HEX FFFF	/ A constant, always FFFF
C2,		HEX 1		/ A constant, always 1
C3,		DEC 10		/ A positive constant value
C4,		DEC -10		/ A negative constant value

O1,		HEX 0

		ORG FFF
A9,		HEX 9876